package com.ted.hole2.model;

import java.io.Serializable;
import java.time.LocalDateTime;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;

import com.ted.hole2.config.HoleService.QueryBuilder;
import com.ted.hole2.config.HoleService.TupleQueryBuilder;

/**
 * The persistent class for the user database table.
 *
 * @author Zhang Kangkang
 */
@Entity
@Table(name = "`user`")
@NamedQuery(name = "User.findAll", query = "SELECT u FROM User u")
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    public User() {}

    /**
     * 用户属性
     */
    public interface Property {

        String TABLE_NAME = "user";

        /**
         * 默认用户权限
         */
        String IS_NOT_MASTER = "0";

        /**
         * 类型
         */
        public interface Type {

            String FIELD_NAME = "type";

            Integer FRONT = 1;

            Integer BACKSTAGE = 2;

            Integer MASTER = 10;
        }

        /**
         * 手机号绑定状态
         */
        public interface PhoneBindStatus {

            /**
             * 已绑定
             */
            Integer BINDED = 1;

            /**
             * 未绑定
             */
            Integer UNBIND = 0;
        }

        /**
         * 组加入情况
         */
        public interface GroupStatus {

            /**
             * 未入组
             */
            Integer NONE = 0;

            /**
             * 已入组
             */
            Integer JOINED = 1;

            /**
             * 申请中
             */
            Integer GOING = 2;

            /**
             * 已拒绝
             */
            Integer REJECT = 3;
        }

    }

    @Id
    @Column(nullable = false)
    private Long id;

    @Column(name = "group_id", nullable = false)
    private Long groupId;

    @Column(name = "account_id", nullable = false)
    private Long accountId;

    @Column(length = 200)
    private String address;

    private Long area;

    @Column(name = "avatar_url", length = 200)
    private String avatarUrl;

    @Column(name = "type", length = 2)
    private Integer type;

    private Long city;

    @Column(length = 200)
    private String email;

    @Column(name = "gmt_create", nullable = false)
    private LocalDateTime gmtCreate;

    @Column(name = "gmt_modified", nullable = false)
    private LocalDateTime gmtModified;

    @Column(name = "group_status", nullable = false)
    private Integer groupStatus;

    @Column(name = "group_status_modified")
    private LocalDateTime groupStatusModified;
    @Column(name = "group_status_remark", length = 200)
    private String groupStatusRemark;
    @Column(name = "is_master")
    private String isMaster;

    @Column(nullable = false, length = 200)
    private String name;

    @Column(length = 200)
    private String nickname;

    @Column(name = "operational_auth", length = 200)
    private String operationalAuth;

    @Column(nullable = false, length = 41)
    private String password;

    @Column(nullable = false)
    private Long phone;

    @Column(name = "phone_bind_status", nullable = false)
    private Integer phoneBindStatus;

    private Long province;

    @Column(name = "role_id", nullable = false)
    private Long roleId;

    @Column(nullable = false)
    private Integer status;

    @Column(name = "status_remark", length = 200)
    private String statusRemark;

    @Column(length = 200)
    private String title;

    public Long getAccountId() {
        return this.accountId;
    }

    public User setAccountId(Long accountId) {
        this.accountId = accountId;
        return this;
    }

    public String getAddress() {
        return this.address;
    }

    public User setAddress(String address) {
        this.address = address;
        return this;
    }

    public Long getArea() {
        return this.area;
    }

    public User setArea(Long area) {
        this.area = area;
        return this;
    }

    public String getAvatarUrl() {
        return this.avatarUrl;
    }

    public User setAvatarUrl(String avatarUrl) {
        this.avatarUrl = avatarUrl;
        return this;
    }

    public Long getCity() {
        return this.city;
    }

    public User setCity(Long city) {
        this.city = city;
        return this;
    }

    public String getEmail() {
        return this.email;
    }

    public User setEmail(String email) {
        this.email = email;
        return this;
    }

    public LocalDateTime getGmtCreate() {
        return this.gmtCreate;
    }

    public User setGmtCreate(LocalDateTime gmtCreate) {
        this.gmtCreate = gmtCreate;
        return this;
    }

    public LocalDateTime getGmtModified() {
        return this.gmtModified;
    }

    public User setGmtModified(LocalDateTime gmtModified) {
        this.gmtModified = gmtModified;
        return this;
    }

    public Long getGroupId() {
        return this.groupId;
    }

    public User setGroupId(Long groupId) {
        this.groupId = groupId;
        return this;
    }

    public Integer getGroupStatus() {
        return this.groupStatus;
    }

    public User setGroupStatus(Integer groupStatus) {
        this.groupStatus = groupStatus;
        return this;
    }

    public LocalDateTime getGroupStatusModified() {
        return this.groupStatusModified;
    }

    public User setGroupStatusModified(LocalDateTime groupStatusModified) {
        this.groupStatusModified = groupStatusModified;
        return this;
    }

    public String getGroupStatusRemark() {
        return this.groupStatusRemark;
    }

    public User setGroupStatusRemark(String groupStatusRemark) {
        this.groupStatusRemark = groupStatusRemark;
        return this;
    }

    public Long getId() {
        return this.id;
    }

    public User setId(Long id) {
        this.id = id;
        return this;
    }

    public String getIsMaster() {
        return this.isMaster;
    }

    public User setIsMaster(String isMaster) {
        this.isMaster = isMaster;
        return this;
    }

    public String getName() {
        return this.name;
    }

    public User setName(String name) {
        this.name = name;
        return this;
    }

    public String getNickname() {
        return this.nickname;
    }

    public User setNickname(String nickname) {
        this.nickname = nickname;
        return this;
    }

    public String getOperationalAuth() {
        return this.operationalAuth;
    }

    public User setOperationalAuth(String operationalAuth) {
        this.operationalAuth = operationalAuth;
        return this;
    }

    public String getPassword() {
        return this.password;
    }

    public User setPassword(String password) {
        this.password = password;
        return this;
    }

    public Long getPhone() {
        return this.phone;
    }

    public User setPhone(Long phone) {
        this.phone = phone;
        return this;
    }

    public Integer getPhoneBindStatus() {
        return this.phoneBindStatus;
    }

    public User setPhoneBindStatus(Integer phoneBindStatus) {
        this.phoneBindStatus = phoneBindStatus;
        return this;
    }

    public Long getProvince() {
        return this.province;
    }

    public User setProvince(Long province) {
        this.province = province;
        return this;
    }

    public Long getRoleId() {
        return this.roleId;
    }

    public User setRoleId(Long roleId) {
        this.roleId = roleId;
        return this;
    }

    public Integer getStatus() {
        return this.status;
    }

    public User setStatus(Integer status) {
        this.status = status;
        return this;
    }

    public String getStatusRemark() {
        return this.statusRemark;
    }

    public User setStatusRemark(String statusRemark) {
        this.statusRemark = statusRemark;
        return this;
    }

    public String getTitle() {
        return this.title;
    }

    public User setTitle(String title) {
        this.title = title;
        return this;
    }

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public static QueryBuilder<User> query() {
        return new TupleQueryBuilder<User>(User.class);
    }

}